const { defineConfig } = require('@vue/cli-service');

const httpURl = process.env.VUE_APP_HTTP_URL; // 获取代理的http

module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false,
  devServer: {
    client: {
      overlay: false,
    },
    proxy: {
      '/api': {
        target: httpURl, // target表示代理的服务器url
        // target: 'http://i8sisv.natappfree.cc',
        changeOrigin: true, //允许跨域
        pathRewrite: { // pathRewrite表示路径重写，key表示一个正则，value表示别名 
          '^/api': '' // 即用 '/api'表示'http://localhost:3000/api'
        }
      }
    }
  },
});
